#ifndef _Light_H_
#define _Light_H_

#pragma once
#include "LightingRender.h"
#include "Ray.h"
#include "Color.h"

class Scene;

class LightSample {
public:
	Color illuminance;
	Vector3 direction;

	LightSample(const Color & illuminance, const Vector3 & direction) : illuminance(illuminance), direction(direction) {}
	LightSample(const LightSample & lightSample) : illuminance(lightSample.illuminance), direction(lightSample.direction) {}
	~LightSample() {}

	inline bool operator==(const LightSample & l) const {
		return illuminance == l.illuminance && direction == l.direction;
	}

	inline bool operator!=(const LightSample & l) const {
		return illuminance != l.illuminance || direction != l.direction;
	}

	inline bool isBlack() {
		return this->illuminance.isBlack();
	}

	inline const static LightSample & Zero() {
		const static LightSample ZeroLightSample = LightSample(Colors::Black, Vector3::Zero());
		return ZeroLightSample;
	}
};

class Light {
protected:
	Float strength = 1.0;
	bool shadow = true;

public:
	Light() {};
	virtual ~Light() {};

	void setShadow(bool shadowOn) {
		shadow = shadowOn;
	}

	void setStrength(Float strength) {
		this->strength = strength;
	}

	virtual int getSampleCount() const {
		return 1;
	}

	virtual LightSample L(const Scene * scene, const Vector3 & position, const Vector3 & normal) const = 0;
};

#endif // _Light_H_